//
//  SYS_MemberDetail1Cell.m
//  System_App
//
//  Created by 魏配军 on 2017/12/5.
//  Copyright © 2017年 czy001. All rights reserved.
//

#import "SYS_MemberDetail1Cell.h"

@implementation SYS_MemberDetail1Cell


-(instancetype)initWithTableView:(UITableView *)tableView  reuseId:(NSString *)reuseId
{
    
    SYS_MemberDetail1Cell *cell = [tableView dequeueReusableCellWithIdentifier:reuseId];
    if (!cell) {
        cell=[[SYS_MemberDetail1Cell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseId];
    }
    return cell;
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addView];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
    }
    return self;
}

-(void) addView
{
    _iconImageView=[UIImageView new];
    
    _nameLabel=[[UILabel alloc]init];
    _nameLabel.textAlignment=NSTextAlignmentLeft;
    _nameLabel.font=[UIFont fontWithName:@"PingFangSC-Regular" size:14];
    _nameLabel.font=[UIFont systemFontOfSize:14];
    _nameLabel.textColor=DGHColorAlpha(20, 20, 20, 1);
    
    [self.contentView sd_addSubviews:@[_iconImageView,_nameLabel]];
    
    _iconImageView.sd_layout
    .leftSpaceToView(self.contentView, 10)
    .topSpaceToView(self.contentView, 10)
    .widthIs(30)
    .heightIs(30);
    
    _nameLabel.sd_layout
    .leftSpaceToView(_iconImageView, 10)
    .topSpaceToView(self.contentView, 15)
    .widthIs(60)
    .heightIs(20);
}

-(void)setLabelArray:(NSArray *)labelArray
{
    _labelArray=labelArray;
    
    float labelWidth=(SCREENWIDTH-80)/3;
    float margin=10;
    float leftMargin=50;
    NSMutableArray *colorArray=[NSMutableArray array];
    UIColor *color=DGHColor(231, 247, 255);
    UIColor *color1=DGHColor(255, 249, 232);
    UIColor *color2=DGHColor(254, 240, 244);
    UIColor *color3=DGHColor(87, 200, 252);

    [colorArray addObject:color];
    [colorArray addObject:color1];
    [colorArray addObject:color2];
    [colorArray addObject:color3];

    for (int index=0; index<labelArray.count; index++) {
        
        UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(leftMargin+(margin+labelWidth)*(index%3), 50+(margin+30)*(index/3), labelWidth, 30)];
        label.backgroundColor=MainColor;
        label.textAlignment=NSTextAlignmentCenter;
        label.backgroundColor=colorArray[index%4];
        label.textColor=DGHColor(100, 100, 100);
        label.font=[UIFont fontWithName:@"PingFangSC-Regular" size:10];
        label.font=[UIFont systemFontOfSize:10];
        label.text=labelArray[index];
        label.layer.masksToBounds=YES;
        label.layer.cornerRadius=15;
        [self.contentView addSubview:label];
        
    }
    
}







@end
